#lang racket


(require "svn.rkt")

(provide rosetta-version
         rosetta-version-major
         rosetta-version-minor
         rosetta-dir
         
         rosetta-update
         
         rosetta-changelog-2.0
         
         format-changelog
         rosetta-changelog)


(define racket-version (make-parameter (version)))
(define racket-dir (make-parameter (format "~A\\~A\\collects\\" (find-system-path 'pref-dir) (racket-version))))

(define rosetta-version (make-parameter (cons 2 0)))
(define rosetta-version-major car)
(define rosetta-version-minor cdr)

(define rosetta-dir (make-parameter (format "~Arosetta\\" (racket-dir))))


(define (rosetta-update)
  (svn-update (rosetta-dir)))


(define rosetta-changelog-2.0
  #<<LOG
Added 'append-first' which appends the first element of a list to the list itself.
Added 'bbox-inflate' which given a bounding box returns a new bounding box with inflated/deflated width, length and height.
Added 'call' which given a function and arguments calls that function (e.g., Common Lisp 'funcall').
Added 'map-append-tree' which performs the same as 'map-tree' but it uses 'append' as reducer function instead of 'cons'.
Added 'map-pair' which maps a list at the list level instead of the element level.
Added 'map-rest' which applies a function to the list tail preserving the list elements.
Added 'pyramid' primitive.
Added 'repeat' which given a list appends the list to itself 'n' times.
Added 'sign' which the returns the sign of a number using -1, 0 or 1.
Added 'surface' primitive that creates surfaces using 3 or 4 points/curves or a closed curve.
Added 'thicken' primitive.
Added Rhinoceros 3D implementations for 'on-right', 'on-front' and 'on-back'.
Added Rhinoceros 3D implementations for 'on-x', 'on-y'.
Added a 'range' macro to replace the previously defined confusing 'range' functions.
Added a convenience constructor for the 'spline' primitive.
Added a more general constructor to 'subtract' to receive a list as second argument.
Added a synthatic extension to the 'repeat' function in the range macro.
Added convenience point constructors 'xy', 'yz', 'xz', '+xy', '+yz' and '+xz'.
Added separate 'line' and 'line-closed' primitives to creates open and closed lines. Notice that 'line' can also create closed lines.
Added several highlevel constructors: 'arc-cs-p', 'bbox-shape', 'cone-frustrum-p', 'cylinder-p', 'pipe-center', 'pyramid-pp', 'move-*' and 'rotate-*'.
Changed 'last' semantics to return last element of a list instead of a list.
Changed function '*2' to work with multiple arguments.
Fixed 'sph-fi' performance.
Fixed Rhinoceros 3D implementation of 'on-z'.
Added 'last-pair' to return the list containing the last element of a list.
Renamed 'bounding-box' constructor to 'bbox'.
Renamed all parametric surfaces to 'skin'.
LOG
  )

(define (format-changelog version log)
  (displayln (format "Rosetta ~A.~A changes:" (rosetta-version-major version) (rosetta-version-minor version)))
  (displayln log))

(define (rosetta-changelog version)
  (match version
    ((cons 2 0) (format-changelog version rosetta-changelog-2.0))))